home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / prog / tpwprog5.arj / WCDEMO.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1992-07-02  |  1.6 KB  |  76 lines

  1. { wcdemo.pas -- WinCrt demonstration }
  2.  
  3. program WCDemo;
  4.  
  5. uses WinCrt;
  6.  
  7. const
  8.  
  9.   maxChoice = 4;    { Number of menu selections }
  10.  
  11. {- Display string S centered at line Y }
  12. procedure Center(Y: Integer; S: String);
  13. begin
  14.   GotoXY(ScreenSize.X div 2 - Length(S) div 2, Y);
  15.   Write(S)
  16. end;
  17.  
  18. {- Display message, then continue after key press }
  19. procedure Pause;
  20. var
  21.   Ch: Char;
  22. begin
  23.   Writeln;
  24.   Write('Press any key to continue...');
  25.   repeat { wait } until KeyPressed;
  26.   Ch := ReadKey
  27. end;
  28.  
  29. {- Display menu. Return true and choice in C; else return false }
  30. function GetChoice(var C: Integer): Boolean;
  31. begin
  32.   repeat
  33.     ClrScr;
  34.     Center( 3, 'M E N U');
  35.     Center( 4, '--------------------');
  36.     Center( 6, '1: System metrics   ');
  37.     Center( 8, '2: Keyboard type    ');
  38.     Center(10, '3: Windows directory');
  39.     Center(12, '4: System flags     ');
  40.     Center(15, '9: Exit             ');
  41.     Center(20, 'Enter selection number: ');
  42.     Readln(C)
  43.   until C in [1 .. maxChoice, 9];
  44.   GetChoice := C <> 9
  45. end;
  46.  
  47. {- To be replaced... }
  48. procedure Dummy(C: Integer);
  49. begin
  50.   Writeln;
  51.   Writeln('You selected choice #', C)
  52. end;
  53.  
  54. var
  55.  
  56.   Choice: Integer;
  57.  
  58. begin
  59.   while GetChoice(Choice) do
  60.   begin
  61.     case Choice of
  62.       1: Dummy(Choice);
  63.       2: Dummy(Choice);
  64.       3: Dummy(Choice);
  65.       4: Dummy(Choice)
  66.     end;
  67.     Pause
  68.   end
  69. end.
  70.  
  71.  
  72. {--------------------------------------------------------------
  73.   Copyright (c) 1991 by Tom Swan. All rights reserved.
  74.   Revision 1.00    Date: 4/05/1991
  75. ---------------------------------------------------------------}
  76.